package com.viu.technology.dto;


import com.viu.technology.util.JsonUtil;

/**
 * 聊天信息的实体类
 */
public class ChatMessage {
    /**
     * 消息ID

     */
    private String messageId;
    /**
     * 发送人ID
     */
    private String senderId;
    /**
     * 接收人ID
     */
    private String recipientId;
    /**
     * 消息内容
     */
    private Object content;
    /**
     * 消息状态，已读、未读、过期等等等
     */
    private Integer status;
    /**
     * 消息发送时间
     */
    private long sendDate;
    /**
     * 消息接收时间
     */
    private long receiptDate;

    /**
     * 消息类型：图片、文字(1)、语音...
     */
    private int type;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public String getRecipientId() {
        return recipientId;
    }

    public void setRecipientId(String recipientId) {
        this.recipientId = recipientId;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public long getSendDate() {
        return sendDate;
    }

    public void setSendDate(long sendDate) {
        this.sendDate = sendDate;
    }

    public long getReceiptDate() {
        return receiptDate;
    }

    public void setReceiptDate(long receiptDate) {
        this.receiptDate = receiptDate;
    }

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }



    @Override
    public String toString() {
        JsonUtil jsonUtil = new JsonUtil();
        return jsonUtil.objectToJsonObject(this).toString();
    }

    /**
     * 默认未读，status=1
     *
     * @param senderId
     * @param recipientId
     * @param content
     */
    public ChatMessage(String messageId, String senderId, String recipientId, Object content,int type) {
        this.messageId = messageId;
        this.senderId = senderId;
        this.recipientId = recipientId;
        this.content = content;
        this.status = 1;
        this.sendDate = System.currentTimeMillis();
        this.type = type;
    }

    public ChatMessage() {
    }

    public static void main(String args[]){
        ChatMessage message = new ChatMessage("12300000001","123", "124", "这是一条消息",1);
        message.setReceiptDate(System.currentTimeMillis());
        System.out.println(message);
    }
}
